package org.gdstash.ui.table;

import org.gdstash.db.DBStashItem;
import org.gdstash.item.GDItem;
import org.gdstash.util.GDMsgFormatter;

public class GDItemSimilarRow {
    public static final Class[] COLUMN_CLASSES;
    public static String[] columnNames;
    public DBStashItem.DuplicateInfo info;
    public GDItem.LabelInfo itemCombo;
    public GDItem.LabelInfo classCombo;
    public GDItem.LabelInfo itemPrefix;
    public GDItem.LabelInfo levelPrefix;
    public GDItem.LabelInfo itemSuffix;
    public GDItem.LabelInfo levelSuffix;

    public GDItemSimilarRow(final DBStashItem.DuplicateInfo info) {
        this.info = info;
        if (info == null) {
            this.itemCombo = new GDItem.LabelInfo();
            this.classCombo = new GDItem.LabelInfo();
            this.itemPrefix = new GDItem.LabelInfo();
            this.levelPrefix = new GDItem.LabelInfo();
            this.itemSuffix = new GDItem.LabelInfo();
            this.levelSuffix = new GDItem.LabelInfo();
        } else {
            this.itemCombo = info.numItemCombo;
            this.classCombo = info.numClassCombo;
            this.itemPrefix = info.numItemPrefix;
            this.levelPrefix = info.levelItemPrefix;
            this.itemSuffix = info.numItemSuffix;
            this.levelSuffix = info.levelItemSuffix;
        }
    }

    public static void updateColumnNames() {
        if (GDItemSimilarRow.columnNames == null) {
            GDItemSimilarRow.columnNames = new String[6];
        }
        GDItemSimilarRow.columnNames[0] = GDMsgFormatter.getString(GDMsgFormatter.rbUI, "TXT_NUM_ITEM");
        GDItemSimilarRow.columnNames[1] = GDMsgFormatter.getString(GDMsgFormatter.rbUI, "TXT_NUM_ITEM_CLASS");
        GDItemSimilarRow.columnNames[2] = GDMsgFormatter.getString(GDMsgFormatter.rbUI, "TXT_NUM_PREFIX");
        GDItemSimilarRow.columnNames[3] = GDMsgFormatter.getString(GDMsgFormatter.rbUI, "TXT_LEVEL_PREFIX");
        GDItemSimilarRow.columnNames[4] = GDMsgFormatter.getString(GDMsgFormatter.rbUI, "TXT_NUM_SUFFIX");
        GDItemSimilarRow.columnNames[5] = GDMsgFormatter.getString(GDMsgFormatter.rbUI, "TXT_LEVEL_SUFFIX");
    }

    static {
        COLUMN_CLASSES = new Class[]{String.class, String.class, String.class, String.class, String.class, String.class};
        GDItemSimilarRow.columnNames = null;
        updateColumnNames();
    }
}
